
////#include "stdafx.h"
#include "CoVector.h"

namespace Cephei
{
	public ref class ADoubleVector : public INativeVector<System::Double>
	{
	private:
		std::vector<double>* _pVValue;
	public:
		ADoubleVector ()
		{
			_pVValue = NULL;
		}
		virtual ~ADoubleVector ()
		{
			if (_pVValue != NULL) delete _pVValue;
		}
		virtual void Add (System::Double item)
		{
			if (_pVValue != NULL)
				_pVValue->push_back (item);
		}
			
		property int Count 
		{
			virtual int get ()
			{
				return _pVValue->size ();
			}
		}

		property System::Double default[int]
		{
			virtual System::Double get (int index)
			{
				return (*_pVValue)[index];
			}
			virtual void set (int index, System::Double value)
			{
				double& d = (*_pVValue)[index];
				d = value;
			}
		}

	public: 
		virtual bool PrepareFeature (NativeFeature feature)
		{
			_pVValue = new std::vector<double> ();
			return true;
		}

	public:
		std::vector<double>& GetValue ()
		{
			 return *_pVValue;
		}


		static operator std::vector<double>& (ADoubleVector^ a) 
		{
			return a->GetValue ();
		}

	};
	public ref class tmp 
	{
	public: 
		static CoVector<System::Double>^ tstCoVec = gcnew CoVector<System::Double> (gcnew ADoubleVector);
	};
}

//ADoubleVector^ t = gcnew ADoubleVector ();